package com.jar.exercise.io.字符流;

import java.io.*;

/**
 * 使用字符缓冲流copy文件
 * BufferedReader 和 BufferedWriter
 */
public class BufferedCopy {
	public static void main(String[] args) {
		try {
			BufferedReader br = new BufferedReader(new FileReader("d:/BufferedCopy.java"));
			BufferedWriter bw = new BufferedWriter(new FileWriter("d:/test.java"));
			String line;
			while ((line = br.readLine()) != null) {
				bw.write(line);
				//readLine不带换行符，需要配合newLine方法
				bw.newLine();
			}
			br.close();
			bw.close();
		} catch (IOException e) {
			e.printStackTrace();
		}

	}
}
